

require(['./config'], () =>{
    require(['request','template','header','footer'],(request,template)=>{
            class Cate {
                constructor (){
                    this.init ()


                }
                init (){
                   
                    const id = window.location.hash.slice(1)
                    // console.log(id)
                    request.getCategory(id).then( resp  =>{
                        // console.log(resp)
                    if (resp.code === 200 ) {
                        const { name } = resp.data.category
                        // console.log({name})
                        const { list } = resp.data.items
                        // $('#titleList').text(template ('titleTemplate',{ name }));
                        $('#categoryList').html(template ('cateTemplate',{ name }));
                        $('#commodityList').html(template ('commodityTemplate',{  list }));
                        
                    }


                    })

                }



            }






            new Cate ()

    })
})